<template>
  <div id="property-management">
    <el-form>
      <el-form-item class="warpper">
        <div class="titleBtn">
          <div class="btn">
            <!--  新增售卖房型 -->
            <div class="add-room-warpper">
              <el-button @click="addRoom(0)"
                v-has="'saleroomstaticroomadd'">新增售卖房型</el-button>
              <el-dialog title="新增售卖房型"
                :visible.sync="addFormVisible"
                v-if="addFormVisible"
                width="650px"
                @close="resetData">
                <el-form label-width="120px"
                  :rules="saleRoomRules"
                  ref="saleRoomRules"
                  :model="saleRoomInformations"
                  :inline-message="true">
                  <h4>基本设置</h4>
                  <el-form-item label="房型名称"
                    prop="saleRoomBaseInfo.roomId">
                    <el-select v-model="saleRoomInformations.saleRoomBaseInfo.roomId"
                      :disabled="isEdit">
                      <el-option v-for="item in roomList"
                        :key="item.id"
                        :value="item.id"
                        :label="item.name"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="售卖房型类型"
                    required>
                    <el-radio v-model="saleRoomInformations.saleRoomBaseInfo.type" @change="typeChange"
                      :label="1">全日房</el-radio>
                    <el-radio v-model="saleRoomInformations.saleRoomBaseInfo.type" @change="typeChange"
                      :label="2">钟点房</el-radio>
                  </el-form-item>
                  <el-form-item label="售卖房型名称"
                    prop="saleRoomBaseInfo.name">
                    <el-input v-model="saleRoomInformations.saleRoomBaseInfo.name"
                      style="width:250px"
                      maxlength="15"></el-input>
                  </el-form-item>
                  <el-form-item label="早餐"
                    v-if="saleRoomInformations.saleRoomBaseInfo.type==1"
                    required>
                    <el-select v-model="saleRoomInformations.saleRoomBaseInfo.breakfast"
                      placeholder="请选择">
                      <el-option label="无早"
                        :value="0"></el-option>
                      <el-option label="双早"
                        :value="3"></el-option>
                      <el-option label="单早"
                        :value="2"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="床型"
                    required>
                    <el-select v-model="saleRoomInformations.saleRoomBaseInfo.bedTypeId"
                      placeholder="请选择床型">
                      <div v-for="item in eidtBedTypeEntities"
                        :key="item.id">
                        <el-option :label="item.name"
                          :value="item.id">{{item.name}}</el-option>
                      </div>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="入住人数"
                    required>
                    <el-select v-model="saleRoomInformations.saleRoomBaseInfo.peopleNum"
                      placeholder="请选择">
                      <el-option label="不限"
                        :value="0"></el-option>
                      <el-option label="1"
                        :value="1"></el-option>
                      <el-option label="2"
                        :value="2"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="可住时段"
                    required
                    v-if="saleRoomInformations.saleRoomBaseInfo.type==2">
                    <el-form-item prop="saleRoomBaseInfo.hourStart" >
                      <el-time-select placeholder="起始时分"
                        :clearable="false"
                        v-model="saleRoomInformations.saleRoomBaseInfo.hourStart"
                        :picker-options="{
                        start: '00:00',
                        step: '00:30',
                        end: '24:00'
                      }">
                      </el-time-select>
                    </el-form-item>
                    <el-form-item prop="saleRoomBaseInfo.hourEnd" >
                      <el-time-select placeholder="结束时分"
                        :clearable="false"
                        v-model="saleRoomInformations.saleRoomBaseInfo.hourEnd"
                        :picker-options="{
                        start: '00:00',
                        step: '00:30',
                        end: '24:00',
                        minTime: renderMinTime(saleRoomInformations.saleRoomBaseInfo.hourStart)
                      }">
                      </el-time-select>
                    </el-form-item>

                  </el-form-item>

                  <el-form-item label="可住时长"
                    required
                    v-if="saleRoomInformations.saleRoomBaseInfo.type==2">
                    <el-form-item prop="saleRoomBaseInfo.hourTime">
                      <el-input-number v-model="saleRoomInformations.saleRoomBaseInfo.hourTime"
                        size="small"
                        controls-position="right"
                        :precision="0"
                        :min="1"></el-input-number>
                    </el-form-item>
                  </el-form-item>
                  <el-form-item label="订单确认"
                    required>
                    <el-radio :label="2"
                      v-model="saleRoomInformations.saleRoomBaseInfo.orderAffirm">订单免确认</el-radio>
                    <el-radio :label="1"
                      v-model="saleRoomInformations.saleRoomBaseInfo.orderAffirm">订单需确认</el-radio>
                  </el-form-item>
                  <h4>规则设置</h4>
                  <el-form-item label="选择日期"
                    prop="saleRoomNewRule.startEndTime">
                    <el-date-picker v-model="saleRoomInformations.saleRoomNewRule.startEndTime"
                      type="daterange"
                      range-separator="至"
                      start-placeholder="开始日期"
                      end-placeholder="结束日期"
                      value-format="yyyy-MM-dd"
                      size="small"
                      :picker-options="pickerOptions"
                      style="width:300px">
                    </el-date-picker>
                  </el-form-item>
                  <div class="item-style">
                    <el-form-item label="取消规则"
                      required>
                      <div class="select">
                        <el-radio v-model="saleRoomInformations.saleRoomNewRule.canBeCancel"
                          :label="0">不可取消</el-radio>
                        <el-radio v-model="saleRoomInformations.saleRoomNewRule.canBeCancel"
                          :label="1">可以取消</el-radio>
                      </div>
                    </el-form-item>
                    <div class="time-select-1"
                      style="padding-left:50px"
                      v-if="saleRoomInformations.saleRoomNewRule.canBeCancel === 1">
                      <el-form-item :label="saleRoomInformations.saleRoomBaseInfo.type ==1 ? '最晚取消时间':'入住前'"
                        required>
                        <el-form-item prop="saleRoomNewRule.advanceCancelHours" style="display:inline-block">
                          <el-select v-model="saleRoomInformations.saleRoomNewRule.advanceCancelHours"
                            placeholder="时">
                            <el-option :label="num"
                              v-for="(num,index) in hour"
                              :key="index"
                              style="width:300px"
                              :value="num"></el-option>
                          </el-select>
                        </el-form-item>
                        <el-form-item prop="saleRoomNewRule.advanceCancelMinutes" style="display:inline-block">
                          <el-select v-model="saleRoomInformations.saleRoomNewRule.advanceCancelMinutes"
                            placeholder="分">
                            <div v-for="(num,index) in minute"
                              :key="index">
                              <el-option :label="num"
                                style="width:300px"
                                :value="num"></el-option>
                            </div>
                          </el-select>
                        </el-form-item>
                      </el-form-item>
                    </div>
                    <el-form-item label="取消单退款设置"
                      v-if="saleRoomInformations.saleRoomNewRule.canBeCancel === 1"
                      prop="saleRoomNewRule.needPay">
                      <span>扣除订单</span>
                      <el-input-number v-model="saleRoomInformations.saleRoomNewRule.needPay"
                        controls-position="right"
                        :min="0"
                        :max="99"
                        :precision="0"
                        size="small"></el-input-number>
                      <span> %手续费</span>
                    </el-form-item>
                    <!-- <div v-if="saleRoomInformations.saleRoomNewRule.canBeCancel === 1"
                      style="padding-left:50px"
                      class="time-select">
                      <el-form-item label="取消说明">
                        <el-input type="textarea"
                          style="width:200px"
                          v-model="saleRoomInformations.saleRoomNewRule.cancelRemark"
                          maxlength="30"></el-input>
                      </el-form-item>
                    </div> -->
                  </div>
                  <el-form-item label="是否开启周末设置"
                    required>
                    <el-radio v-model="saleRoomInformations.saleRoomNewRule.weekend"
                      :label="2">关闭</el-radio>
                    <el-radio v-model="saleRoomInformations.saleRoomNewRule.weekend"
                      :label="1">开启</el-radio>
                  </el-form-item>
                  <el-form-item label="自定义周末"
                    prop="saleRoomNewRule.dateRange.weeks"
                    v-if="saleRoomInformations.saleRoomNewRule.weekend==1">
                    <el-checkbox-group v-model="saleRoomInformations.saleRoomNewRule.dateRange.weeks">
                      <el-checkbox v-for="item in weekList"
                        :key="item.id"
                        :label="item.id">{{item.title}}</el-checkbox>
                    </el-checkbox-group>
                  </el-form-item>
                  <el-form-item label="房价设置">
                    <el-form-item label="网络价"
                      prop="saleRoomNewRule.salePrice">
                      <el-input-number v-model="saleRoomInformations.saleRoomNewRule.salePrice"
                        controls-position="right"
                        :min="0"
                        :max="200000"
                        size="small"></el-input-number>
                    </el-form-item>
                    <el-form-item label="周末网络价"
                      prop="saleRoomNewRule.weekendPrice"
                      v-if="saleRoomInformations.saleRoomNewRule.weekend==1">
                      <el-input-number v-model="saleRoomInformations.saleRoomNewRule.weekendPrice"
                        controls-position="right"
                        :min="0"
                        :max="200000"
                        size="small"></el-input-number>
                    </el-form-item>

                  </el-form-item>
                  <el-form-item label="房量设置">
                    <el-form-item label="正常房量"
                      prop="saleRoomNewRule.saleNum">
                      <el-input-number v-model="saleRoomInformations.saleRoomNewRule.saleNum"
                        controls-position="right"
                        :min="0"
                        :precision="0"
                        :max="200000"
                        size="small"></el-input-number>
                    </el-form-item>
                    <el-form-item label="周末房量"
                      prop="saleRoomNewRule.weekendNum"
                      v-if="saleRoomInformations.saleRoomNewRule.weekend==1">
                      <el-input-number v-model="saleRoomInformations.saleRoomNewRule.weekendNum"
                        controls-position="right"
                        :min="0"
                        :max="200000"
                        :precision="0"
                        size="small"></el-input-number>
                    </el-form-item>
                  </el-form-item>

                </el-form>
                <div slot="footer"
                  class="dialog-footer">
                  <el-button type="primary"
                    @click="addPhysicsType('saleRoomRules',1)"
                    style="color: #fff;">保存(待上线)</el-button>
                  <el-button type="primary"
                    style="color: #fff;"
                    @click="addPhysicsType('saleRoomRules',0)">上线</el-button>
                  <el-button @click="addFormVisible = false">取消</el-button>
                </div>
              </el-dialog>
            </div>
            <!-- 批量修改基础信息 -->
            <div class="patch-edit"
              v-if="RoomtableData.length">
              <el-button @click="editBaseInfo(1)"
                v-has="'updateroomstatus'">批量修改全日房基础信息</el-button>
              <el-dialog title="批量修改基础信息"
                :visible.sync="pathEditBaseInfo"
                @close="patchEditClose"
                width="800px">
                <el-form label-width="100px"
                  ref="baseForm"
                  :rules="saleRoomRules"
                  :inline-message="true"
                  :model="saleRoomBaseInfo">
                  <el-form-item label="售卖房型"
                    required>
                    <div>
                      <el-checkbox v-model="checked"
                        @change="handleCheckAllChange">全选</el-checkbox>
                    </div>
                    <el-checkbox v-for="(item,index) in saleRooms"
                      style="margin:0 5px 0 0;width:30%"
                      :label="item.id"
                      v-model="item.checked"
                      @change="handleCheckedRoomDataChange"
                      :key="index">{{item.roomName}}</el-checkbox>
                  </el-form-item>
                  <el-form-item label="早餐"
                    v-if="type==1"
                    required>
                    <el-select v-model="saleRoomBaseInfo.breakfast"
                      placeholder="请选择">
                      <el-option label="不变"
                        value=""></el-option>
                      <el-option label="无早"
                        :value="0"></el-option>
                      <el-option label="双早"
                        :value="3"></el-option>
                      <el-option label="单早"
                        :value="2"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="床型"
                    required>
                    <el-select v-model="saleRoomBaseInfo.bedTypeId"
                      placeholder="请选择">
                      <el-option label="不变"
                        value=""></el-option>
                      <div v-for="item in eidtBedTypeEntities"
                        :key="item.id">
                        <el-option :label="item.name"
                          :value="item.id">{{item.name}}</el-option>
                      </div>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="入住人数"
                    required>
                    <el-select v-model="saleRoomBaseInfo.peopleNum"
                      placeholder="请选择">
                      <el-option label="不变"
                        value=""></el-option>
                      <el-option label="不限"
                        :value="0"></el-option>
                      <el-option label="1"
                        :value="1"></el-option>
                      <el-option label="2"
                        :value="2"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item v-if="type==2"
                    label="可住时段"
                    required>
                    <el-select v-model="saleRoomBaseInfo.starEndType"
                      @change="starEndTypeChange">
                      <el-option label="不变"
                        value=""></el-option>
                      <el-option label="变更为"
                        :value="1"></el-option>
                    </el-select>
                    <div>
                      <el-form-item prop="hourStart"
                        style="display:inline-block;"
                        v-if="saleRoomBaseInfo.starEndType==1">
                        <el-time-select placeholder="起始时分"
                          :clearable="false"
                          v-model="saleRoomBaseInfo.hourStart"
                          :picker-options="{
                        start: '00:00',
                        step: '00:30',
                        end: '24:00'
                      }">
                        </el-time-select>
                      </el-form-item>
                      <el-form-item prop="hourEnd"
                        style="display:inline-block;"
                        v-if="saleRoomBaseInfo.starEndType==1">
                        <el-time-select placeholder="结束时分"
                          :clearable="false"
                          v-model="saleRoomBaseInfo.hourEnd"
                          :picker-options="{
                        start: '00:00',
                        step: '00:30',
                        end: '24:00',
                        minTime: renderMinTime(saleRoomBaseInfo.hourStart)
                      }">
                        </el-time-select>
                      </el-form-item>
                    </div>
                  </el-form-item>
                  <el-form-item v-if="type==2"
                    label="可住时长"
                    required>
                    <el-select v-model="saleRoomBaseInfo.timeType" >
                      <el-option label="不变"
                        value=""></el-option>
                      <el-option label="变更为"
                        :value="1"></el-option>
                    </el-select>

                  </el-form-item>
                  <el-form-item v-if="saleRoomBaseInfo.timeType==1"
                    prop="hourTime">
                    <el-input-number v-model="saleRoomBaseInfo.hourTime"
                      size="small"
                      controls-position="right"
                      :precision="0"
                      :min="1"
                      :max="24"></el-input-number>
                  </el-form-item>
                  <el-form-item label="订单确认"
                    required>
                    <el-select v-model="saleRoomBaseInfo.orderAffirm"
                      placeholder="请选择">
                      <el-option label="不变"
                        value=""></el-option>
                      <el-option label="订单免确认"
                        :value="2"></el-option>
                      <el-option label="订单需确认"
                        :value="1"></el-option>
                    </el-select>
                  </el-form-item>
                </el-form>
                <div slot="footer"
                  class="dialog-footer">
                  <el-button type="primary"
                    @click="batchSaleRoomBaseSave('baseForm')"
                    style="color: #fff;">保存</el-button>
                  <el-button @click="pathEditBaseInfo = false">取消</el-button>
                </div>
              </el-dialog>
            </div>
            <!-- 批量修改取消规则 -->
            <div class="patch-edit"
              v-if="RoomtableData.length">
              <el-button @click="batchSetting(1)"
                v-has="'updateroomstatus'">批量修改全日房取消规则</el-button>
              <el-dialog title="批量修改取消规则"
                :visible.sync="pathEditCancelRule"
                @close="patchEditClose"
                width="800px">
                <el-form label-width="100px">
                  <el-form-item label="售卖房型"
                    required>
                    <div>
                      <el-checkbox v-model="checked"
                        @change="handleCheckAllChange">全选</el-checkbox>
                    </div>
                    <el-checkbox v-for="(item,index) in saleRooms"
                      style="width:30%;margin:0 5px 0 0"
                      :label="item.id"
                      v-model="item.checked"
                      @change="handleCheckedRoomDataChange"
                      :key="index">{{item.roomName}}</el-checkbox>
                  </el-form-item>
                  <el-form-item label="变更日期"
                    required>
                    <div v-for="(item,index) in saleRoomCancelRuleData.dateSpans"
                      :key="index">
                      <el-date-picker v-model="item.startEndTime"
                        size="small"
                        style="width:300px"
                        type="daterange"
                        :picker-options="pickerOptions"
                        range-separator="至"
                        start-placeholder="开始日期"
                        value-format="yyyy-MM-dd"
                        end-placeholder="结束日期">
                      </el-date-picker>
                      <i class="el-icon-plus icon_"
                        v-if="index == 0"
                        @click="addDate(saleRoomCancelRuleData.dateSpans)"></i>
                      <i class="el-icon-minus icon_"
                        v-if="index!==0"
                        @click="reduceDate(index,saleRoomCancelRuleData.dateSpans)"></i>
                    </div>
                  </el-form-item>
                  <el-form-item label="适用星期"
                    required>
                    <el-checkbox v-model="checkedVal"
                      @change="checkAllXq">
                      全部
                    </el-checkbox>
                    <el-checkbox-group v-model="saleRoomCancelRuleData.weeks"
                      @change="checkXq">
                      <el-checkbox v-for="item in weekList"
                        :key="item.id"
                        :label="item.id">{{item.title}}</el-checkbox>
                    </el-checkbox-group>
                  </el-form-item>
                  <el-form-item label="取消规则"
                    required>
                    <el-radio v-model="saleRoomCancelRuleData.canBeCancel"
                      :label="0">不可取消</el-radio>
                    <el-radio v-model="saleRoomCancelRuleData.canBeCancel"
                      :label="1">可以取消</el-radio>
                  </el-form-item>
                  <div class="time-select-1"
                    style="padding-left:50px"
                    v-if="saleRoomCancelRuleData.canBeCancel === 1">
                    <el-form-item :label="type ==1 ? '最晚取消时间':'入住前'"
                      required>
                      <el-select v-model="saleRoomCancelRuleData.advanceCancelHours"
                        placeholder="时">
                        <el-option :label="num"
                          v-for="(num,index) in hour"
                          :key="index"
                          style="width:300px"
                          :value="num"></el-option>
                      </el-select>
                      <el-select v-model="saleRoomCancelRuleData.advanceCancelMinutes"
                        placeholder="分">
                        <div v-for="(num,index) in minute"
                          :key="index">
                          <el-option :label="num"
                            style="width:300px"
                            :value="num"></el-option>
                        </div>
                      </el-select>
                    </el-form-item>
                  </div>
                  <el-form-item label="取消单退款设置"
                    v-if="saleRoomCancelRuleData.canBeCancel === 1"
                    prop="saleRoomNewRule.needPay">
                    <span>扣除订单</span>
                    <el-input-number v-model="saleRoomCancelRuleData.needPay"
                      controls-position="right"
                      :min="0"
                      :precision="0"
                      :max="100"
                      size="small"></el-input-number>
                    <span> %手续费</span>
                  </el-form-item>
                  <!-- <div v-if="saleRoomCancelRuleData.canBeCancel === 1"
                    style="padding-left:50px"
                    class="time-select">
                    <el-form-item label="取消说明">
                      <el-input type="textarea"
                        style="width:200px"
                        v-model="saleRoomCancelRuleData.cancelRemark"
                        maxlength="30"></el-input>
                    </el-form-item>
                  </div> -->
                </el-form>
                <div slot="footer"
                  class="dialog-footer">
                  <el-button type="primary"
                    @click="batchSaleRoomSave"
                    style="color: #fff;">保存</el-button>
                  <el-button @click="pathEditCancelRule = false">取消</el-button>
                </div>
              </el-dialog>
            </div>
            <!--  批量修改房价 -->
            <div class="patch-price"
              v-if="RoomtableData.length">
              <el-button @click="patchPriceNumber"
                v-has="'updateroomprices'">批量修改房价</el-button>
              <el-dialog title="批量改房价"
                :visible.sync="patchPrice"
                width="750px"
                @close="patchEditClose">
                <el-form label-width="100px">
                  <el-form-item label="变更日期"
                    required>
                    <div v-for="(item,index) in saleRoomPrices.dateSpans"
                      :key="index">
                      <el-date-picker v-model="item.startEndTime"
                        size="small"
                        style="width:300px"
                        type="daterange"
                        :picker-options="pickerOptions"
                        range-separator="至"
                        start-placeholder="开始日期"
                        value-format="yyyy-MM-dd"
                        end-placeholder="结束日期">
                      </el-date-picker>
                      <i class="el-icon-plus icon_"
                        v-if="index == 0"
                        @click="addDate(saleRoomPrices.dateSpans)"></i>
                      <i class="el-icon-minus icon_"
                        v-if="index!==0"
                        @click="reduceDate(index,saleRoomPrices.dateSpans)"></i>
                    </div>
                  </el-form-item>

                  <el-form-item label="适用星期"
                    required>
                    <el-checkbox v-model="checkedVal"
                      @change="checkAllXq">
                      全部
                    </el-checkbox>
                    <el-checkbox-group v-model="saleRoomPrices.weeks"
                      @change="checkXq">
                      <el-checkbox v-for="item in weekList"
                        :key="item.id"
                        :label="item.id">{{item.title}}</el-checkbox>
                    </el-checkbox-group>
                  </el-form-item>
                  <el-form-item label="变价方式"
                    required>
                    <el-radio :label="1"
                      v-model="saleRoomPrices.roomSet">
                      直接设置房价
                    </el-radio>
                    <el-radio :label="2"
                      v-model="saleRoomPrices.roomSet">
                      按幅度增减
                    </el-radio>
                  </el-form-item>
                  <el-form-item style="height:500px;overflow-y:auto">
                    <ul class="prices-list">
                      <li style="background:#f2f2f2">
                        <span>
                          <el-checkbox v-model="checked"
                            @change="allSelect">售卖房型</el-checkbox>
                        </span>
                        <span v-if="saleRoomPrices.roomSet==1"
                          class="list-header">网络价</span>
                        <span v-if="saleRoomPrices.roomSet==2"
                          class="list-header">增减价格</span>
                      </li>
                      <li v-for="(item,index) in saleRooms"
                        :key="index">
                        <span>
                          <span>
                            <el-checkbox v-model="item.checked"
                              @change="onlySelect">{{item.roomName}}

                            </el-checkbox>
                          </span>
                          <el-select v-model="item.roomCount"
                            v-if="saleRoomPrices.roomSet==2"
                            style="width:100px">
                            <el-option :value="1"
                              label="增价"></el-option>
                            <el-option :value="2"
                              label="减价"></el-option>
                          </el-select>
                        </span>
                        <span>
                          <el-form-item style="display:inline-block">
                            <el-input-number controls-position="right"
                              v-model="item.salePrice"
                              :min="0"
                              :max="200000"
                              size="small"></el-input-number>
                          </el-form-item>
                        </span>
                      </li>
                    </ul>
                  </el-form-item>

                </el-form>
                <div slot="footer"
                  class="dialog-footer">
                  <el-button type="primary"
                    @click="patchPriceNumberSave"
                    style="color: #fff;">保存</el-button>
                  <el-button @click="patchPrice = false">取消</el-button>
                </div>
              </el-dialog>
            </div>
            <!-- 批量设置房量 -->
            <div class="patch-edit"
              v-if="RoomtableData.length">
              <el-button @click="patchSetRoomSum('')"
                v-has="'updateroomstatus'">批量设置房量</el-button>
              <el-dialog title="批量设置房量"
                :visible.sync="patchRoomSum"
                width="750px"
                @close="patchEditClose">
                <el-form label-width="100px">
                  <el-form-item label="售卖房型"
                    required>
                    <div>
                      <el-checkbox v-model="checked"
                        @change="handleCheckAllChange">全选</el-checkbox>
                    </div>

                    <el-checkbox v-for="(item,index) in saleRooms"
                      style="width:30%;margin:0 5px 0 0"
                      :label="item.id"
                      v-model="item.checked"
                      @change="handleCheckedRoomDataChange"
                      :key="index">{{item.roomName}}</el-checkbox>
                  </el-form-item>
                  <el-form-item label="变更日期"
                    required>
                    <div v-for="(item,index) in saleRoomNum.dateSpans"
                      :key="index">
                      <el-date-picker v-model="item.startEndTime"
                        size="small"
                        style="width:300px"
                        type="daterange"
                        :picker-options="pickerOptions"
                        range-separator="至"
                        start-placeholder="开始日期"
                        value-format="yyyy-MM-dd"
                        end-placeholder="结束日期">
                      </el-date-picker>
                      <i class="el-icon-plus icon_"
                        v-if="index == 0"
                        @click="addDate(saleRoomNum.dateSpans)"></i>
                      <i class="el-icon-minus icon_"
                        v-if="index!==0"
                        @click="reduceDate(index,saleRoomNum.dateSpans)"></i>
                    </div>
                  </el-form-item>

                  <el-form-item label="适用星期"
                    required>
                    <el-checkbox v-model="checkedVal"
                      @change="checkAllXq">
                      全部
                    </el-checkbox>
                    <el-checkbox-group v-model="saleRoomNum.weeks"
                      @change="checkXq">
                      <el-checkbox v-for="item in weekList"
                        :key="item.id"
                        :label="item.id">{{item.title}}</el-checkbox>
                    </el-checkbox-group>
                  </el-form-item>
                  <el-form-item label="房量">
                    <el-select v-model="saleRoomNum.operator">
                      <el-option label="加房"
                        :value="0"></el-option>
                      <el-option label="减房"
                        :value="1"></el-option>
                      <el-option label="等于"
                        :value="2"></el-option>
                    </el-select>
                    <el-input-number controls-position="right"
                      v-model="saleRoomNum.quantity"
                      :min="0"
                      :precision="0"
                      :max="200000"
                      size="small"></el-input-number>
                  </el-form-item>
                </el-form>
                <div slot="footer"
                  class="dialog-footer">
                  <el-button type="primary"
                    @click="patchRoomNumSave"
                    style="color: #fff;">保存</el-button>
                  <el-button @click="patchRoomSum = false">取消</el-button>
                </div>
              </el-dialog>
            </div>
            <br/>
            <!-- 批量修改钟点房基础信息 -->
            <div class="patch-edit">
              <el-button @click="editBaseInfo(2)">批量修改钟点房基础信息</el-button>
            </div>
            <!-- 批量修改钟点房取消规则 -->
            <div class="patch-edit">
              <el-button @click="batchSetting(2)">批量修改钟点房取消规则</el-button>
            </div>

          </div>
        </div>
        <div class="calendar">
          <div class="select">
            <el-select v-model="weekOrMouth"
              @change="weekChange">
              <el-option label="按周"
                value="按周"></el-option>
              <el-option label="按月"
                value="按月"></el-option>
            </el-select>
          </div>
          <div class="left-btn">
            <el-button @click="beforeWeek">前一周</el-button>
          </div>
          <div class="date">
            <el-date-picker v-model="defaultValue.startDate"
              type="date"
              :picker-options="pickerOptions"
              @change="dateChange"
              value-format="yyyy-MM-dd"
              placeholder="选择日期">
            </el-date-picker>
          </div>
          <div class="right-btn">
            <el-button @click="afterWeek">后一周</el-button>
          </div>
        </div>
      </el-form-item>
      <el-form-item>
        <div class="calendar-list">
          <div class="calendar-header">
            <div class="calendar-header-warpper">
              <div class="item"
                v-for="(num, index) in calendarData"
                :key="index">
                <label>{{num}}</label>
              </div>
            </div>
          </div>
          <div class="calendar-body"
            ref="calendarBody">
            <div class="calendar-body-warpper">
              <div class="calendar-warpper-content">
                <div class="calendar-content"
                  v-for="(data, index) in RoomtableData"
                  :key="index">
                  <div class="calendar-content-module">
                    <div class="physics">
                      <span style="color:#000;font-weight:bold">{{data.roomName}}</span><br />
                      <el-button type="text"
                        @click="addRoom(data.id)"
                        v-has="'addsaleroom'">新增售卖房型</el-button>
                      <img :src="data.url"
                        alt=""
                        width="100">
                    </div>
                    <div class="date-information">
                      <div class="date-warpper">
                        <div class="sale-room-title">
                          <div class="sale-room-title-item"
                            v-for="(item, numLine) in data.saleRoomEntities"
                            :key="item.id">
                            <div class="sale-title-content">
                              <div style="color:#000;font-weight:bold">{{item.roomName}}</div>
                              <div class="brakfast-style">
                                <!-- 基础信息 -->
                                <label>{{item.type ==1?item.breakfast+'&nbsp;':''}}{{item.bed}}&nbsp;{{item.num}}&nbsp;{{item.affirm}}&nbsp;{{item.hour}}</label>
                              </div>
                              <el-button type="text"
                                @click="saleRoomEdits(item)"
                                v-has="'updatesaleroom'">修改基础信息</el-button>
                            </div>
                            <div class="sale-date"
                              :class="{'up-style': item.status === '上线'}">
                              <div class="item"
                                v-for="num in item.productEntities"
                                :key="num.id">
                                <div class="item-content">
                                  <div class="item-child"
                                    :class="{'warpper-second': num.status === '关' && item.status === '下线', 'warpper-first': num.status === '满' && item.status === '下线', 'warpper-third': num.status === '' && item.status === '下线'}">
                                    <div class="item-text">
                                      <label :class="{'down-style': item.status === '上线'}"
                                        style="color:#000;font-weight:bold">{{num.date.substring(5)}}<br/></label>
                                      <label :class="{'down-style': item.status === '上线'}"
                                        v-if="num.salePrice">网络价&nbsp;</label>
                                      <label :class="{'down-style': item.status === '上线', 'red': item.status === '下线'}"
                                        v-if="num.salePrice">￥{{num.salePrice}}<br/></label>
                                      <label :class="{'down-style': item.status === '上线'}"
                                        v-if="num.salePrice&& num.vipPrice">{{num.vipName}}&nbsp;</label>
                                      <label v-if="num.vipPrice && num.salePrice"
                                        :class="{'down-style': item.status === '上线', 'red': item.status === '下线'}">￥{{num.vipPrice ? num.vipPrice : ''}}<br/></label>
                                      <label :class="{'down-style': item.status === '上线'}"
                                        v-if="num.salePrice">库存：{{num.usedQuantity}}/{{num.totalQuantity}}<br/></label>
                                      <label :class="{'down-style': item.status === '上线'}"
                                        v-if="num.salePrice">{{num.cancel}}</label>
                                      <div class="manchu"
                                        v-if="num.status === '满' && item.status === '下线'">满</div>
                                      <div class="closed"
                                        v-if="num.status === '关' && item.status === '下线'">关</div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                            <div class="operation">
                              <el-button type="text"
                                v-has="'updateproduct'"
                                @click="saleRoomEditLineShow(item)">修改规则信息</el-button>
                              <el-button type="text"
                                v-has="'updatesaleroomstatus'"
                                @click="stateSwitch(item, numLine)">{{item.status}}</el-button>
                              <el-button type="text"
                                v-has="'updatesaleroomstatus'"
                                v-if="item.status=='上线'"
                                @click="_deleteSaleRoom(item.id)">删除</el-button>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="calendar-foot"></div>
        </div>
      </el-form-item>
      <el-form-item style="margin: 20px 0;"
        class="foot-pagination">
        <el-pagination @size-change="handleRoomSizeChange"
          @current-change="handleRoomCurrentChange"
          :current-page="RoomCurrentPage"
          :page-sizes="[5, 10]"
          :page-size="RoomPageSize"
          layout="total, prev , pager , next, sizes, jumper"
          :total="RoomTotal">
        </el-pagination>
      </el-form-item>
      <!-- 修改售卖房型基本资料 -->
      <div class="add-sale-room">
        <el-dialog title="修改售卖房型基本资料"
          :visible.sync="editRooms"
          v-if="editRooms"
          width="600px">
          <el-form label-width="100px"
            :rules="saleRoomRules"
            :model="saleRoomInformations"
            ref="saleRoomBaseInfo"
            :inline-message="true">
            <el-form-item label="房型名称">
              <el-input v-model="saleRoomInformations.saleRoomBaseInfo.staticRoomName"
                style="width:200px"
                disabled></el-input>
            </el-form-item>
            <el-form-item label="售卖房型名称"
              required>
              <el-input v-model="saleRoomInformations.saleRoomBaseInfo.name"
                style="width:200px"
                auto-complete="off"></el-input>
            </el-form-item>
            <el-form-item label="早餐"
              v-if="type==1"
              required>
              <el-select v-model="saleRoomInformations.saleRoomBaseInfo.breakfast"
                placeholder="请选择">
                <el-option label="无早"
                  :value="0"></el-option>
                <el-option label="双早"
                  :value="3"></el-option>
                <el-option label="单早"
                  :value="2"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="床型"
              required>
              <el-select v-model="saleRoomInformations.saleRoomBaseInfo.bedTypeId"
                placeholder="请选择">
                <div v-for="item in eidtBedTypeEntities"
                  :key="item.id">
                  <el-option :label="item.name"
                    :value="item.id">{{item.name}}</el-option>
                </div>
              </el-select>
            </el-form-item>
            <el-form-item label="入住人数"
              required>
              <el-select v-model="saleRoomInformations.saleRoomBaseInfo.peopleNum"
                placeholder="请选择">
                <el-option label="不限"
                  :value="0"></el-option>
                <el-option label="1"
                  :value="1"></el-option>
                <el-option label="2"
                  :value="2"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="可住时段"
              required
              v-if="type==2">
              <el-form-item prop="saleRoomBaseInfo.hourStart">
                <el-time-select placeholder="起始时分"
                  :clearable="false"
                  v-model="saleRoomInformations.saleRoomBaseInfo.hourStart"
                  :picker-options="{
                        start: '00:00',
                        step: '00:30',
                        end: '24:00'
                      }">
                </el-time-select>
              </el-form-item>
              <el-form-item prop="saleRoomBaseInfo.hourEnd">
                <el-time-select placeholder="结束时分"
                  :clearable="false"
                  v-model="saleRoomInformations.saleRoomBaseInfo.hourEnd"
                  :picker-options="{
                        start: '00:00',
                        step: '00:30',
                        end: '24:00',
                        minTime:renderMinTime(saleRoomInformations.saleRoomBaseInfo.hourStart)
                      }">
                </el-time-select>
              </el-form-item>
            </el-form-item>
            <el-form-item label="可住时长"
              required
              v-if="type==2">
              <el-form-item prop="saleRoomBaseInfo.hourTime">
                <el-input-number v-model="saleRoomInformations.saleRoomBaseInfo.hourTime"
                  size="small"
                  controls-position="right"
                  :precision="0"
                  :min="1"></el-input-number>
              </el-form-item>
            </el-form-item>
            <el-form-item label="订单确认"
              required>
              <el-radio :label="2"
                v-model="saleRoomInformations.saleRoomBaseInfo.orderAffirm">订单免确认</el-radio>
              <el-radio :label="1"
                v-model="saleRoomInformations.saleRoomBaseInfo.orderAffirm">订单需确认</el-radio>
            </el-form-item>
          </el-form>
          <div slot="footer"
            class="dialog-footer">
            <el-button type="primary"
              @click="saveInformation('saleRoomBaseInfo')">确认</el-button>
            <el-button @click="editRooms = false">取消</el-button>
          </div>
        </el-dialog>
      </div>
      <!-- 修改规则信息 -->
      <div class="edit-rules">
        <el-dialog title="修改售卖房型规则设置"
          :visible.sync="editRoomRules"
          width="650px"
          @close="patchEditClose">
          <el-form label-width="120px"
            :inline-message="true">
            <el-form-item label="售卖房型名称"
              required>
              <el-input v-model="editRoomRule.name"
                disabled
                style="width:250px"></el-input>
            </el-form-item>
            <el-form-item label="变更日期"
              required>
              <div v-for="(item,index) in editRoomRule.dateSpans"
                :key="index">
                <el-date-picker v-model="item.startEndTime"
                  size="small"
                  style="width:300px"
                  type="daterange"
                  :picker-options="pickerOptions"
                  range-separator="至"
                  start-placeholder="开始日期"
                  value-format="yyyy-MM-dd"
                  end-placeholder="结束日期">
                </el-date-picker>
                <i class="el-icon-plus icon_"
                  v-if="index == 0"
                  @click="addDate(editRoomRule.dateSpans)"></i>
                <i class="el-icon-minus icon_"
                  v-if="index!==0"
                  @click="reduceDate(index,editRoomRule.dateSpans)"></i>
              </div>
            </el-form-item>

            <el-form-item label="适用星期"
              required>
              <el-checkbox v-model="checkedVal"
                @change="checkAllXq">
                全部
              </el-checkbox>
              <el-checkbox-group v-model="editRoomRule.weeks"
                @change="checkXq">
                <el-checkbox v-for="item in weekList"
                  :key="item.id"
                  :label="item.id">{{item.title}}</el-checkbox>
              </el-checkbox-group>
            </el-form-item>
            <div class="item-style clearfix">
              <el-form-item label="取消规则"
                required>
                <div class="select">
                  <el-radio v-model="editRoomRule.canBeCancel"
                    label="">不变</el-radio>
                  <el-radio v-model="editRoomRule.canBeCancel"
                    :label="0">不可取消</el-radio>
                  <el-radio v-model="editRoomRule.canBeCancel"
                    :label="1">可以取消</el-radio>
                </div>
              </el-form-item>
              <div class="time-select-1"
                style="padding-left:50px"
                v-if="editRoomRule.canBeCancel === 1">
                <el-form-item :label="type ==1 ? '最晚取消时间':'入住前'"
                 
                  required>
                  <el-form-item prop="saleRoomNewRule.advanceCancelHours" style="display:inline-block">
                    <el-select v-model="editRoomRule.advanceCancelHours"
                      placeholder="时">
                      <el-option :label="num"
                        v-for="(num,index) in hour"
                        :key="index"
                        style="width:300px"
                        :value="num"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item prop="saleRoomNewRule.advanceCancelMinutes" style="display:inline-block">
                    <el-select v-model="editRoomRule.advanceCancelMinutes"
                      placeholder="分">
                      <div v-for="(num,index) in minute"
                        :key="index">
                        <el-option :label="num"
                          style="width:300px"
                          :value="num"></el-option>
                      </div>
                    </el-select>
                  </el-form-item>
                </el-form-item>
              </div>
              <el-form-item label="取消单退款设置"
                class="fl"
                v-if="editRoomRule.canBeCancel === 1"
                prop="saleRoomNewRule.needPay">
                <span>扣除订单</span>
                <el-input-number v-model="editRoomRule.needPay"
                  controls-position="right"
                  :min="0"
                  :max="100"
                  :precision="0"
                  size="small"></el-input-number>
                <span> %手续费</span>
              </el-form-item>
            </div>
            <div class="price">
              <el-form-item label="变价方式"
                required>
                <el-radio label=""
                  v-model="editRoomRule.roomSet">
                  不变
                </el-radio>
                <el-radio :label="1"
                  v-model="editRoomRule.roomSet">
                  直接设置房价
                </el-radio>
                <el-radio :label="2"
                  v-model="editRoomRule.roomSet">
                  按幅度增减
                </el-radio>
              </el-form-item>
              <el-form-item v-if="editRoomRule.roomSet">
                <ul class="prices-list">
                  <li style="background:#f2f2f2;padding-left:10px">
                    <span>
                      售卖房型
                    </span>
                    <span v-if="editRoomRule.roomSet==1"
                      class="list-header">网络价</span>
                    <span v-if="editRoomRule.roomSet==2"
                      class="list-header">增减价格</span>
                  </li>
                  <li style="padding-left:10px">
                    <span>{{editRoomRule.name}}</span>
                    <span style="width:150px">
                      <el-select v-model="editRoomRule.roomCount"
                        v-if="editRoomRule.roomSet==2"
                        style="width:100px">
                        <el-option :value="1"
                          label="增价"></el-option>
                        <el-option :value="2"
                          label="减价"></el-option>
                      </el-select>
                    </span>
                    <span>
                      <el-form-item style="display:inline-block">
                        <el-input-number controls-position="right"
                          v-model="editRoomRule.salePrice"
                          :min="0"
                          :max="200000"
                          size="small"></el-input-number>
                      </el-form-item>
                    </span>
                  </li>
                </ul>
              </el-form-item>
              <el-form-item label="房量"
                required>
                <el-select v-model="editRoomRule.operator">
                  <el-option label="不变"
                    value=""></el-option>
                  <el-option label="加房"
                    :value="0"></el-option>
                  <el-option label="减房"
                    :value="1"></el-option>
                  <el-option label="等于"
                    :value="2"></el-option>
                </el-select>
                <el-input-number controls-position="right"
                  v-if="editRoomRule.operator!==''"
                  v-model="editRoomRule.quantity"
                  :min="0"
                  :max="200000"
                  :precision="0"
                  size="small"></el-input-number>
              </el-form-item>
            </div>
          </el-form>
          <div slot="footer"
            class="dialog-footer">

            <el-button type="primary"
              style="color: #fff;"
              @click="saleRoomEditLineBtn">保存</el-button>
            <el-button @click="editRoomRules = false">取消</el-button>
          </div>
        </el-dialog>
      </div>
    </el-form>
  </div>
</template>
<script>
import {
  updateProduct,
  getSaleRoomAllRooms,
  getSuperior,
  getBedList,
  updateSalerules,
  getloadItens,
  addSaleRoom,
  updateSaleRoom,
  updateRoomStatus,
  getMinimalList,
  updateRoomPrices,
  getProductQuery,
  shareProduct,
  saleRoomToggle,
  deleteSaleRoom,
  getDateProduct,
  getSaleRoom,
  editSaleRoom,
  getSaleRoomList,
  addStaticRoom,
  getChannels,
  updateBase
} from "../../../public/js/saleRoom";
import { formatInput } from "@/public/js/util";
export default {
  props: ["dataTable"],
  name: "InventoryManagement",
  data() {
    var checkNeedPay = (rule, value, callback) => {
      if (!value || value == 0) {
        return callback(new Error("扣除订单手续费不能为空或为零"));
      } else {
        callback();
      }
    };
    var startTime = (rule, value, callback) => {
      let _start = this.timeList.findIndex(item => item == value);
      let _end = this.timeList.findIndex(
        item => item == this.saleRoomInformations.saleRoomBaseInfo.hourEnd
      );
      if (_end - _start <= 0) {
        return callback(new Error("结束时间不能小于开始时间"));
      } else {
        callback();
      }
    };
    var startTime_1 = (rule, value, callback) => {
      let _start = this.timeList.findIndex(item => item == value);
      let _end = this.timeList.findIndex(
        item => item == this.saleRoomBaseInfo.hourEnd
      );
      if (_end - _start <= 0) {
        return callback(new Error("结束时间不能小于开始时间"));
      } else {
        callback();
      }
    };
    var checkTime = (rule, value, callback) => {
      let _start = this.timeList.findIndex(
        item => item == this.saleRoomInformations.saleRoomBaseInfo.hourStart
      );
      let _end = this.timeList.findIndex(
        item => item == this.saleRoomInformations.saleRoomBaseInfo.hourEnd
      );
      if ((_end - _start) / 2 < value) {
        return callback(
          new Error("可住时长只能小于等于" + (_end - _start) / 2 + "个小时")
        );
      } else {
        callback();
      }
    };
    var checkTime_1 = (rule, value, callback) => {
      let _start = this.timeList.findIndex(
        item => item == this.saleRoomBaseInfo.hourStart
      );
      let _end = this.timeList.findIndex(
        item => item == this.saleRoomBaseInfo.hourEnd
      );
      if ((_end - _start) / 2 < value) {
        return callback(
          new Error("可住时长只能小于等于" + (_end - _start) / 2 + "个小时")
        );
      } else {
        callback();
      }
    };
    return {
      hours: 3,
      radio: 1, //订单是否需确认
      vipPriceType: null, //会员修改类型 默认为不变
      vipPrice: "",
      isIndeterminate: true,
      buttonFormVisible: false,
      addFormVisible: false,
      pathEditCancelRule: false, // 批量修改取消规则
      addSellingHouseType: false,
      pathEditBaseInfo: false, //批量修改基础信息
      patchRoomSum: false, //批量设置房量
      editRoomRules: false,
      patchPrice: false,
      patchSetting: false,
      patchPosted: false,
      editRooms: false,
      saleRoomEdit: false,
      saleRoomEditLine: false,
      sendWeekRoom: false,
      addRoomData: [],
      physicsRoomName: "",
      distributorsList: [],
      calendar: true,
      calendarCheckAll: [],
      priceTable: [],
      patchPriceTable: [],
      distributors: null,
      SaleRoomRulesUpdateRequest: {},
      bedTypeEntities: [],
      smallKey: true,
      bigKey: true,
      second: false,
      first: false,

      supplierName: "",
      formatInput,
      saleRooms: [], //售卖酒店列表
      physicsRoomData: {
        saleRoomBaseInfo: {}
      },
      weekList: [
        {
          title: "一",
          id: "1",
          check: true
        },
        {
          title: "二",
          id: "2",
          check: true
        },
        {
          title: "三",
          id: "3",
          check: true
        },
        {
          title: "四",
          id: "4",
          check: true
        },
        {
          title: "五",
          id: "5",
          check: true
        },
        {
          title: "六",
          id: "6",
          check: true
        },
        {
          title: "日",
          id: "7",
          check: true
        }
      ],
      timeList: [],
      calendarData: [
        "物理房型",
        "售卖房型",
        "周日",
        "周一",
        "周二",
        "周三",
        "周四",
        "周五",
        "周六",
        "操作"
      ],
      editPriceData: [
        "物理房型",
        "适用日期",
        "适用星期",
        "采购价",
        "美团",
        "易旅"
      ],
      calendarAll: [],
      pickerOptions: {
        disabledDate: function disabledDate(time) {
          return time.getTime() < Date.now() - 8.64e7;
        }
      },
      weekData: [{ children: [] }],
      priceAddPatch: [{ name: "" }],
      editPriceState: 0,
      addRoomCheck: false,
      addRoomCheckArray: [],
      roomTableArray: [],
      RoomNameArray: [],
      valueTime: "",
      hour: [
        "00",
        "01",
        "02",
        "03",
        "04",
        "05",
        "06",
        "07",
        "08",
        "09",
        "10",
        "11",
        "12",
        "13",
        "14",
        "15",
        "16",
        "17",
        "18",
        "19",
        "20",
        "21",
        "22",
        "23"
      ],
      minute: [
        "00",
        "05",
        "10",
        "15",
        "20",
        "25",
        "30",
        "35",
        "40",
        "45",
        "50",
        "55"
      ],
      optionLabel: "不变",
      dialogFormVisible: false,
      weekOrMouth: "按周",
      checkNum: "",
      items: { name: "不变" },
      saleRoomPrices: {
        dateSpans: [
          {
            startEndTime: []
          }
        ],
        weeks: [],
        roomSet: 1
      },
      priceState: true,
      RoomtableData: [],
      RoomPageSize: 10,
      RoomCurrentPage: 1,
      RoomTotal: 0,
      currentPage: "first",
      checkAll: false,
      addRoomCheckAll: false,
      weekCheckAll: [],
      settingRoomcheckAll: [],
      defaultValue: {
        timestamp: 0,
        version: "string",
        operation: "string",
        pageSize: 10,
        pageNum: 1,
        supplierId: "",
        saleHotelId: "",
        startDate: window.commo.time(),
        limitDays: 7,
        status: ""
      },
      RoomSendValue: {
        timestamp: 0,
        version: "string",
        operation: "string"
      },
      saleRoomIds: [],
      staticRoomIds: [],
      staticRooms: [],
      saleRoomPopover: [],
      staticRoomPopover: [],
      total: 0,
      threeLayersData: [],
      threeLayersDataSeconde: [],
      numArray: 0,
      numArraySeconde: 0,
      numArrayThrid: 0,
      numArrayZero: 0,
      staticRoomsCheck: [],
      type: "",
      saleRoomInformations: {
        saleRoomBaseInfo: {
          saleHotelId: "",
          roomId: "",
          name: "",
          breakfast: 0,
          bedTypeId: 1,
          peopleNum: 2,
          orderAffirm: 2,
          type: 1,
          hourTime: 3
        },
        saleRoomNewRule: {
          startEndTime: [],
          dateRange: {
            dateSpan: {
              start: "",
              end: ""
            },
            weeks: []
          },
          canBeCancel: 0,
          advanceCancelHours: "",
          advanceCancelMinutes: "",
          needPay: undefined,
          cancelRemark: "",
          weekend: 2,
          salePrice: undefined,
          saleNum: undefined,
          weekendPrice: undefined,
          weekendNum: undefined
        },

        status: 0 //上线下线
      },
      saleRoomCancelRuleData: {
        saleRoomIds: [],
        dateSpans: [
          {
            startEndTime: []
          }
        ],
        weeks: [],
        canBeCancel: 0,
        advanceCancelHours: "",
        advanceCancelMinutes: "",
        needPay: undefined,
        cancelRemark: ""
      },
      saleRoomBaseInfo: {
        saleRoomIds: [],
        breakfast: "",
        bedTypeId: "",
        peopleNum: "",
        orderAffirm: "",
        hourStart: "08:00",
        hourEnd: "20:00",
        hourTime: 3,
        starEndType: "",
        timeType: ""
      },
      saleRoomNum: {
        saleRoomIds: [],
        dateSpans: [
          {
            startEndTime: []
          }
        ],
        weeks: [],
        operator: 2,
        quantity: undefined
      },
      editRoomRule: {
        name: "",
        saleRoomId: "",
        dateSpans: [
          {
            startEndTime: []
          }
        ],
        weeks: [],
        salePrice: undefined,
        operator: "",
        quantity: undefined,
        canBeCancel: "",
        advanceCancelHours: undefined,
        advanceCancelMinutes: undefined,
        needPay: undefined,
        cancelRemark: "",
        roomSet: "",
        roomCount: 1
      },
      checked: false,
      checkedVal: false,
      isEdit: false,
      saleRoomRules: {
        "saleRoomBaseInfo.name": [
          { required: true, message: "请输入售卖房型名称", trigger: "blur" }
        ],
        "saleRoomBaseInfo.roomId": [
          { required: true, message: "请选择房型名称", trigger: "change" }
        ],
        hourStart: [
          {
            validator: startTime_1,
            trigger: "change"
          }
        ],

        hourTime: [
          {
            validator: checkTime_1,
            trigger: "blur change"
          }
        ],
        "saleRoomBaseInfo.hourStart": [
          {
            validator: startTime,
            trigger: "change"
          }
        ],

        "saleRoomBaseInfo.hourEnd": [
          {
            required: true,
            message: "请选择结束时分",
            trigger: "change"
          }
        ],
        "saleRoomBaseInfo.hourTime": [
          {
            validator: checkTime,
            trigger: "blur change"
          }
        ],
        "saleRoomNewRule.advanceCancelHours": [
          {
            required: true,
            message: "请选择入住前-时",
            trigger: "change"
          }
        ],
        "saleRoomNewRule.advanceCancelMinutes": [
          {
            required: true,
            message: "请选择入住前-分",
            trigger: "change"
          }
        ],

        "saleRoomNewRule.needPay": [
          { validator: checkNeedPay, trigger: "change" }
        ],
        "saleRoomNewRule.salePrice": [
          { required: true, message: "请输入网络价格", trigger: "blur" }
        ],
        "saleRoomNewRule.weekendPrice": [
          { required: true, message: "请输入周末网络价格", trigger: "blur" }
        ],
        "saleRoomNewRule.saleNum": [
          { required: true, message: "请输入正常房量", trigger: "blur" }
        ],
        "saleRoomNewRule.weekendNum": [
          { required: true, message: "请输入周末房量", trigger: "blur" }
        ],
        "saleRoomNewRule.dateRange.weeks": [
          {
            type: "array",
            required: true,
            message: "至少选择一个日期",
            trigger: "blur"
          }
        ],
        "saleRoomNewRule.startEndTime": [
          {
            type: "array",
            required: true,
            message: "请选择日期",
            trigger: "blur"
          }
        ]
      },
      startEndTime: [],
      sendRoomUpadate: {
        dateRange: {
          dateSpan: {},
          weeks: []
        }
      },
      editSaleRoomPatch: {
        dateRanges: [
          {
            dateSpan: {
              start: "",
              end: ""
            },
            weeks: [],
            parent: false
          }
        ]
      },
      supplierNames: [],
      physicsBedTypeEntities: [],
      physicsStaticRoomId: 0,
      editPhysicsRoomName: "",
      editRoomsSupplierNames: [],
      eidtBedTypeEntities: [],
      editSaleRoomId: 0,
      saleRoomEditName: "",
      status: "",
      state: [],
      stateNumbers: 0,
      priceAll: false,
      elementHeight: 0,
      pricePermissions: parseInt(sessionStorage.getItem("pricePermissions")),
      ifPricesText: "显示底价",
      isVipPrice: false,
      start_end_time: [],
      roomList: [], //物理房型列表
      roomId: "" //物理房型Id
    };
  },
  watch: {
    dataTable: {
      handler(val, old) {
        this.staticRoomPopover = [];
        this.threeLayersData = [];
        this.calendarCheckAll = [];
        this.RoomtableData = val;
        if (this.RoomtableData.length > 0) {
          this.RoomtableData.forEach((item, index) => {
            this.calendarCheckAll.push({ parent: false, children: [] });
            if (item.saleRoomEntities) {
              this.threeLayersData.push(item.saleRoomEntities);
            }
          });
          if (this.RoomtableData[0].saleRoomEntities) {
            if (this.RoomtableData[0].saleRoomEntities.length > 0) {
              if (this.RoomtableData[0].saleRoomEntities[0].productEntities) {
                if (
                  this.RoomtableData[0].saleRoomEntities[0].productEntities
                    .length > 0
                ) {
                  this.RoomtableData[0].saleRoomEntities[0].productEntities.forEach(
                    (item, index) => {
                      if (index < 7) {
                        this.calendarData[index + 2] = item.week;
                      }
                    }
                  );
                }
              }
            }
          }
        }
      },
      deep: true
    }
  },
  created() {
    this.getSpaceTime();
  },
  mounted() {
    window.bus.$on("pricePermissions", res => {
      this.pricePermissions = res;
    });
    window.bus.$on("InventoryData", res => {
      this.staticRoomPopover = [];
      this.threeLayersData = [];
      this.calendarCheckAll = [];
      this.RoomtableData = res;
      if (this.RoomtableData.length > 0) {
        this.RoomtableData.forEach((item, index) => {
          this.calendarCheckAll.push({ parent: false, children: [] });
          if (item.saleRoomEntities) {
            this.threeLayersData.push(item.saleRoomEntities);
          }
        });
        if (this.RoomtableData[0].saleRoomEntities) {
          if (this.RoomtableData[0].saleRoomEntities.length > 0) {
            if (this.RoomtableData[0].saleRoomEntities[0].productEntities) {
              if (
                this.RoomtableData[0].saleRoomEntities[0].productEntities
                  .length > 0
              ) {
                this.RoomtableData[0].saleRoomEntities[0].productEntities.forEach(
                  (item, index) => {
                    if (index < 7) {
                      this.calendarData[index + 2] = item.week;
                    }
                  }
                );
              }
            }
          }
        }
      }
    });
    window.bus.$on("SaleInformation", res => {
      this.defaultValue.supplierId = res.supplierId;
      this.defaultValue.status = res.status;
      this.defaultValue.saleHotelId = res.saleHotelId;
      this.RoomTotal = this.total = res.total;
      this.RoomCurrentPage = 1;
      this.RoomPageSize = 10;
    });
    window.bus.$on("limitDays", res => {
      if (res === 7) this.weekOrMouth = "按周";
      if (res === 30) this.weekOrMouth = "按月";
    });
  },
  methods: {
    renderMinTime(startTime) {
      console.log("startTime", startTime);
      let _start = this.timeList.findIndex(item => item == startTime);
      return this.timeList[_start + 1];
    },
    timeChange(start, end, time) {
      let _start = "",
        _end = "";
      _start = this.timeList.findIndex(item => item == start);
      _end = this.timeList.findIndex(item => item == end);
      let index = _end - _start - 1;
      if (_end - _start <= 0) {
        this.$message.error("钟点房结束时间不能小于开始时间");
        return true;
      }
      if (index < time) {
        this.$message.error("钟点房时长不能大于" + index + "个小时");
        return true;
      }
    },
    ft(time) {
      if (time < 10) {
        return "0" + time;
      } else {
        return time;
      }
    },
    getSpaceTime(space = 30) {
      let hour = 0;
      let min = 0;
      let spaceArr = [];
      space = parseInt(space);
      while (hour <= 24) {
        spaceArr.push(this.ft(hour) + ":" + this.ft(min));
        min += space > 0 ? space : -space;
        if (hour == 24) {
          break;
        }
        if (min >= 60) {
          hour++;
          min = min - 60;
        }
      }
      this.timeList = spaceArr;
    },
    patchEditClose() {
      this.checked = false;
      this.checkedVal = false;
      this.saleRoomPrices = {
        dateSpans: [
          {
            startEndTime: []
          }
        ],
        weeks: [],
        roomSet: 1
      };
      this.saleRoomCancelRuleData = {
        saleRoomIds: [],
        dateSpans: [
          {
            startEndTime: []
          }
        ],
        weeks: [],
        canBeCancel: 0,
        advanceCancelHours: "",
        advanceCancelMinutes: "",
        needPay: undefined,
        cancelRemark: ""
      };
      this.saleRoomBaseInfo = {
        saleRoomIds: [],
        breakfast: "",
        bedTypeId: "",
        peopleNum: "",
        orderAffirm: "",
        hourStart: "08:00",
        hourEnd: "20:00",
        hourTime: 3,
        starEndType: "",
        timeType: ""
      };
      this.saleRoomNum = {
        saleRoomIds: [],
        dateSpans: [
          {
            startEndTime: []
          }
        ],
        weeks: [],
        operator: 2,
        quantity: undefined
      };
      this.editRoomRule = {
        name: "",
        saleRoomId: "",
        dateSpans: [
          {
            startEndTime: []
          }
        ],
        weeks: [],
        salePrice: undefined,
        operator: "",
        quantity: undefined,
        canBeCancel: "",
        advanceCancelHours: undefined,
        advanceCancelMinutes: undefined,
        needPay: undefined,
        cancelRemark: "",
        roomSet: "",
        roomCount: 1
      };
    },
    bigKeys(val) {
      if (val) this.bigKey = false;
    },
    smallKeys(val) {
      if (val) this.bigKey = true;
    },
    //批量修改房型基本资料
    editBaseInfo(type) {
      this.type = type;
      this.pathEditBaseInfo = true;
      this._getMinimalList();
      this._getBedType();
      console.log(this.saleRoomBaseInfo);
    },
    typeChange(type){
      console.log(type)
      if(type==2) {
        this.saleRoomInformations.saleRoomNewRule.advanceCancelHours = "00";
        this.saleRoomInformations.saleRoomNewRule.advanceCancelMinutes = "15";
      }else{
        this.saleRoomInformations.saleRoomNewRule.advanceCancelHours = "";
        this.saleRoomInformations.saleRoomNewRule.advanceCancelMinutes = "";
      }
    },
    //批量修改房型基本资料保存
    batchSaleRoomBaseSave(formName) {
      let flag = true;
      for (let item of this.saleRooms) {
        if (item.checked) {
          flag = false;
        }
      }
      if (flag) {
        this.$message.error("请选择要操作的售卖房型");
        return false;
      }
      this.$refs[formName].validate(valid => {
        console.log(valid);
        if (valid) {
          let saleRoomIds = [];
          this.saleRooms.forEach(item => {
            if (item.checked) {
              saleRoomIds.push(item.id);
            }
          });
          let {
            breakfast,
            bedTypeId,
            peopleNum,
            orderAffirm,
            hourStart,
            hourEnd,
            hourTime
          } = this.saleRoomBaseInfo;
          let data = {
            saleRoomIds,
            breakfast,
            bedTypeId,
            peopleNum,
            orderAffirm,
            hourStart,
            hourEnd,
            hourTime
          };
          if(!this.saleRoomBaseInfo.starEndType) {
             data.hourStart = "";
             data.hourEnd = "";
          }
          updateBase(data).then(res => {
            if (!res.data.errCode) {
              this.$message.success("修改成功");
              this.getProductQuerys();
              this.pathEditBaseInfo = false;
            }
          });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    starEndTypeChange(value) {
      if (value == 1) {
        this.saleRoomBaseInfo.timeType = 1;
      } else {
        this.saleRoomBaseInfo.timeType = "";
      }
    },
    renderTime() {},
    checkAllXq(val, obj) {
      this.editRoomRule.weeks = [];
      this.saleRoomCancelRuleData.weeks = [];
      this.saleRoomPrices.weeks = [];
      this.saleRoomNum.weeks = [];
      if (val) {
        this.weekList.forEach(item => {
          this.editRoomRule.weeks.push(item.id);
          this.saleRoomCancelRuleData.weeks.push(item.id);
          this.saleRoomPrices.weeks.push(item.id);
          this.saleRoomNum.weeks.push(item.id);
        });
      }
    },
    checkXq(val) {
      if (val.length === this.weekList.length) {
        this.checkedVal = true;
      } else {
        this.checkedVal = false;
      }
    },
    /* 批量房态/单个房型修改星期全选 */
    handleWeekRoom(val, index) {
      if (val) {
        [1, 2, 3, 4, 5, 6, 7].forEach(item => {
          this.editSaleRoomPatch.dateRanges[index].weeks.push(item);
        });
      } else {
        this.editSaleRoomPatch.dateRanges[index].weeks = [];
      }
      this.editSaleRoomPatch.dateRanges[index].weeks = Array.from(
        new Set(this.editSaleRoomPatch.dateRanges[index].weeks)
      );
    },
    /* 批量房态/单个房型修改星期单选 */
    handleWeekRoomCheck(val, index) {
      if (val.length === 7) {
        this.editSaleRoomPatch.dateRanges[index].parent = true;
      } else {
        this.editSaleRoomPatch.dateRanges[index].parent = false;
      }
    },

    /* 重置勾选值 */
    resetData() {
      this.saleRoomInformations = {
        saleRoomBaseInfo: {
          saleHotelId: "",
          roomId: "",
          name: "",
          breakfast: 0,
          bedTypeId: 1,
          peopleNum: 2,
          orderAffirm: 2,
          type: 1,
          hourTime: 3,
          hourStart: "08:00",
          hourEnd: "20:00"
        },
        saleRoomNewRule: {
          startEndTime: [],
          dateRange: {
            dateSpan: {
              start: "",
              end: ""
            },
            weeks: []
          },
          canBeCancel: 0,
          advanceCancelHours: "",
          advanceCancelMinutes: "",
          needPay: undefined,
          cancelRemark: "",
          weekend: 2,
          salePrice: undefined,
          saleNum: undefined,
          weekendPrice: undefined,
          weekendNum: undefined
        },
        status: 0 //上线下线
      };
    },
    /* 修改售卖房型展示按钮 */
    saleRoomEditLineShow(data) {
      this.type = data.type;
      this.editRoomRules = true;
      if(this.type==1) {
        this.editRoomRule.advanceCancelHours = "";
        this.editRoomRule.advanceCancelMinutes = "";
      }else{
         this.editRoomRule.advanceCancelHours = "00";
        this.editRoomRule.advanceCancelMinutes = "15";
      }
      this.editRoomRule.name = data.roomName;
      this.editRoomRule.saleRoomId = data.id;
    },
    /* 修改售卖房型保存按钮 */
    saleRoomEditLineBtn() {
      console.log(this.editRoomRule);
      //表单验证
      for (let item of this.editRoomRule.dateSpans) {
        if (!item.startEndTime.length) {
          this.$message.error("请输入变更日期");
          return false;
        }
      }
      if (!this.editRoomRule.weeks.length) {
        this.$message.error("请输入适用星期");
        return false;
      }
      if (this.editRoomRule.canBeCancel == 1) {
        if (!this.editRoomRule.advanceCancelHours) {
          this.$message.error("请输入入住前-时");
          return false;
        }
        if (!this.editRoomRule.advanceCancelMinutes) {
          this.$message.error("请输入入住前-分");
          return false;
        }
        if (!this.editRoomRule.needPay) {
          this.$message.error("请输入取消扣款比例");
          return false;
        }
      }
      if (this.editRoomRule.roomSet == 1) {
        if (!this.editRoomRule.salePrice) {
          this.$message.error("请输入售卖房型变价金额");
          return false;
        }
      } else if (this.editRoomRule.roomSet == 2) {
        if (!this.editRoomRule.salePrice) {
          this.$message.error("请输入售卖房型变价金额");
          return false;
        }
      }
      if (this.editRoomRule.operator !== "") {
        if (!this.editRoomRule.quantity) {
          this.$message.error("请输入房量");
          return false;
        }
      }
      let dateRanges = [];
      this.editRoomRule.dateSpans.forEach(item => {
        dateRanges.push({
          dateSpan: {
            start: item.startEndTime[0],
            end: item.startEndTime[1]
          }
        });
      });
      let {
        saleRoomId,
        weeks,
        salePrice,
        operator,
        quantity,
        canBeCancel,
        advanceCancelHours,
        advanceCancelMinutes,
        needPay,
        cancelRemark,
        roomSet,
        roomCount
      } = this.editRoomRule;
      let data = {
        saleRoomId,
        weeks,
        salePrice,
        operator,
        quantity,
        canBeCancel,
        advanceCancelHours,
        advanceCancelMinutes,
        needPay,
        cancelRemark,
        roomSet,
        roomCount,
        dateRange: dateRanges
      };
      console.log(data);
      updateProduct(data).then(res => {
        if (res.data.errCode === 0) {
          this.$message.success("修改成功");
          this.getProductQuerys();
          this.editRoomRules = false;
        }
      });
    },
    //获取所有物理房型和售卖房型列表数据
    _getAllRooms() {
      let { supplierId, saleHotelId } = this.defaultValue;
      let data = {
        supplierId,
        saleHotelId,
        staticRoomIds: [],
        saleRoomIds: []
      };
      getSaleRoomAllRooms(data).then(res => {
        console.log(res);
      });
    },

    /* 批量发布售卖房型展示按钮 */
    patchPostedEvent() {
      this.tickerStateData();
      this.patchPosted = true;
      this.staticRooms = [];
      this.threeLayersDataSeconde = [];
      this.staticRoomsCheck = [];
      let data = {
        supplierId: this.defaultValue.supplierId,
        saleHotelId: this.defaultValue.saleHotelId,
        staticRoomIds: [],
        saleRoomIds: []
      };
      getSaleRoomAllRooms(data)
        .then(res => {
          if (res.data.errCode === 0) {
            this.staticRooms = res.data.staticRooms;
            this.staticRooms.forEach(item => {
              this.staticRoomsCheck.push({ parent: false, children: [] });
              this.threeLayersDataSeconde.push(item.saleRooms);
            });
            this.settingRoomcheckAll = true;
            this.staticSetSelectAll(true);
          }
        })
        .then(() => {
          getChannels().then(res => {
            if (res.data.errCode === 0) {
              this.distributorsList = res.data.list;
              this.distributors = res.data.list[0].id;
            }
          });
        });
    },
    //刷新页面数据
    _getProductQuery() {
      getProductQuery(this.defaultValue).then(res => {
        if (res.data.errCode === 0) {
          this.RoomtableData = res.data.staticRoomEntities;
          this.dataSet(this.RoomtableData);
        }
        this.resetData();
      });
    },

    /* 上下线状态切换 */
    stateSwitch(data, index) {
      this.RoomSendValue.id = data.id;
      if (data.status === "上线") this.status = 0;
      if (data.status === "下线") this.status = 1;
      this.$confirm("确定切换房型状态?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        saleRoomToggle(this.status, data.id, this.defaultValue).then(res => {
          if (res.data.errCode === 0) {
            this.$message.success("状态修改成功");
            this._getProductQuery();
          }
        });
      });
    },

    /* 删除售卖房型 */
    _deleteSaleRoom(id) {
      this.$confirm("此操作将永久删除该房型, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true
      }).then(() => {
        deleteSaleRoom({ id }).then(res => {
          if (res.data.errCode === 0) {
            this.resetData();
            this._getProductQuery();
          }
        });
      });
    },
    /* 时间按钮 */
    dateChange(val) {
      this.defaultValue.startDate = val;
      window.bus.$emit("starDate", val);
      getProductQuery(this.defaultValue).then(res => {
        if (res.data.errCode === 0) {
          this.RoomtableData = res.data.staticRoomEntities;
          this.dataSet(this.RoomtableData);
          this.resetData();
          for (let i = 0; i < 7; i++) {
            this.calendarData[i + 2] =
              res.data.staticRoomEntities[0].saleRoomEntities[0].productEntities[
                i
              ].week;
          }
        }
      });
    },
    /* 周月按钮 */
    weekChange(val) {
      if (val === "按周") this.defaultValue.limitDays = 7;
      if (val === "按月") this.defaultValue.limitDays = 30;
      if (!this.defaultValue.startDate) delete this.defaultValue.startDate;
      window.bus.$emit("limitDays", this.defaultValue.limitDays);
      getProductQuery(this.defaultValue).then(res => {
        if (res.data.errCode === 0) {
          this.RoomtableData = res.data.staticRoomEntities;
          this.dataSet(this.RoomtableData);
        }
        this.resetData();
      });
    },
    handleWeekChange(mode) {
      this.defaultValue.limitDays = 7;
      window.bus.$emit("limitDays", this.defaultValue.limitDays);
      getDateProduct(this.defaultValue, mode).then(res => {
        if (res.status === 200) {
          this.defaultValue.startDate = res.data;
          getProductQuery(this.defaultValue).then(res => {
            if (res.data.errCode === 0) {
              this.RoomtableData = res.data.staticRoomEntities;
              this.dataSet(this.RoomtableData);
              this.resetData();
            }
          });
        }
      });
    },

    dataSet(data) {
      this.calendarCheckAll = [];
      if (data.length > 0) {
        data.forEach((item, index) => {
          this.calendarCheckAll.push({ parent: false, children: [] });
          if (item.saleRoomEntities) {
            this.threeLayersData.push(item.saleRoomEntities);
          }
        });
        if (data[0].saleRoomEntities) {
          if (data[0].saleRoomEntities.length > 0) {
            if (data[0].saleRoomEntities[0].productEntities) {
              if (data[0].saleRoomEntities[0].productEntities.length > 0) {
                data[0].saleRoomEntities[0].productEntities.forEach(
                  (item, index) => {
                    if (index < 7) {
                      this.calendarData[index + 2] = item.week;
                    }
                  }
                );
              }
            }
          }
        }
      }
    },
    /* 前一周按钮 */
    beforeWeek() {
      this.handleWeekChange(0);
    },
    /* 后一周按钮 */
    afterWeek() {
      this.handleWeekChange(1);
    },
    /* 修改售卖房型信息展示按钮 */
    saleRoomEdits(data) {
      this.type = data.type;
      this.editRooms = true;
      this.editSaleRoomId = data.id;
      console.log(data);
      getSaleRoom(data.id).then(res => {
        this.saleRoomInformations.saleRoomBaseInfo = res.data.saleRoomBaseInfo;
        if (!this.saleRoomInformations.saleRoomBaseInfo.orderAffirm) {
          this.saleRoomInformations.saleRoomBaseInfo.orderAffirm = 2;
        }
        console.log("this.saleRoomInformations", this.saleRoomInformations);
        this._getBedType();
      });
    },
    /* 修改售卖房型信息保存按钮 */
    saveInformation(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          let {
            id,
            name,
            bedTypeId,
            peopleNum,
            breakfast,
            orderAffirm,
            hourStart,
            hourEnd,
            hourTime
          } = this.saleRoomInformations.saleRoomBaseInfo;
          let saleRoomBaseInfo = {
            id,
            name,
            bedTypeId,
            peopleNum,
            breakfast,
            orderAffirm,
            hourStart,
            hourEnd,
            hourTime
          };

          editSaleRoom({ saleRoomBaseInfo }).then(res => {
            if (res.data.errCode === 0) {
              this.$message.success("修改成功");
              this.editRooms = false;
              this._getProductQuery();
            }
            this.resetData();
          });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    //获取物理房型列表
    _getRoomList() {
      let { saleHotelId } = this.defaultValue;
      getSaleRoomList({ saleHotelId }).then(res => {
        if (res.data.errCode === 0) {
          this.roomList = res.data.list;
          this.addFormVisible = true;
        }
      });
    },
    // 获取床型
    _getBedType() {
      getloadItens(this.defaultValue.saleHotelId).then(res => {
        this.eidtBedTypeEntities = res.data.bedTypeEntities;
      });
    },
    /* 新增房型展示按钮 */
    addRoom(roomId) {
      this.resetData();
      if (roomId) {
        this.isEdit = true;
        this.saleRoomInformations.saleRoomBaseInfo.roomId = roomId;
        
      } else {
        this.isEdit = false;
        this.saleRoomInformations.saleRoomBaseInfo.roomId = "";
      }
      this._getRoomList();
      this._getBedType();

      this.saleRoomInformations.saleRoomBaseInfo.saleHotelId = this.defaultValue.saleHotelId;
    },
    /* 新增房型保存按钮 */
    addPhysicsType(formName, status) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          this.saleRoomInformations.saleRoomNewRule.dateRange.dateSpan = {
            start: this.saleRoomInformations.saleRoomNewRule.startEndTime[0],
            end: this.saleRoomInformations.saleRoomNewRule.startEndTime[1]
          };
          this.saleRoomInformations.status = status;
          delete this.saleRoomInformations.saleRoomNewRule.startEndTime;

          addSaleRoom(this.saleRoomInformations).then(res => {
            if (!res.data.errCode) {
              this.$message.success("新增房型成功");
              this._getProductQuery();
              this.resetData();
              this.addFormVisible = false;
            }
          });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },

    /* 批量设置售卖房型展示按钮 */
    patchSettingRoom() {
      this.tickerStateData();
      this.patchSetting = true;
      this.staticRooms = [];
      this.threeLayersDataSeconde = [];
      this.staticRoomsCheck = [];
      getBedList(this.defaultValue)
        .then(res => {
          if (res.data.errCode === 0)
            this.bedTypeEntities = res.data.bedTypeEntities;
        })
        .then(() => {
          getSaleRoomAllRooms(
            this.staticRoomPopover,
            this.saleRoomPopover,
            this.defaultValue
          ).then(res => {
            this.staticRooms = res.data.staticRooms;
            this.staticRooms.forEach(item => {
              this.staticRoomsCheck.push({ parent: false, children: [] });
              this.threeLayersDataSeconde.push(item.saleRooms);
            });
            this.settingRoomcheckAll = true;
            this.staticSetSelectAll(true);
          });
        });
    },
    /* 批量修改售卖房型保存按钮 */
    batchSaleRoomSave() {
      /***表单验证 */

      let flag = true;
      for (let item of this.saleRooms) {
        if (item.checked) {
          flag = false;
        }
      }
      if (flag) {
        this.$message.error("请选择要操作的售卖房型");
        return false;
      }
      for (let item of this.saleRoomCancelRuleData.dateSpans) {
        if (!item.startEndTime.length) {
          this.$message.error("请输入变更日期");
          return false;
        }
      }
      if (!this.saleRoomCancelRuleData.weeks.length) {
        this.$message.error("请输入适用星期");
        return false;
      }
      if (this.saleRoomCancelRuleData.canBeCancel == 1) {
        if (!this.saleRoomCancelRuleData.advanceCancelHours) {
          this.$message.error("请输入入住前-时");
          return false;
        }
        if (!this.saleRoomCancelRuleData.advanceCancelMinutes) {
          this.$message.error("请输入入住前-分");
          return false;
        }
        if (!this.saleRoomCancelRuleData.needPay) {
          this.$message.error("请输入取消扣款比例");
          return false;
        }
      }
      let saleRoomIds = [];
      let dateRanges = [];

      this.saleRooms.forEach(item => {
        if (item.checked) {
          saleRoomIds.push(item.id);
        }
      });

      this.saleRoomCancelRuleData.dateSpans.forEach(item => {
        dateRanges.push({
          dateSpan: {
            start: item.startEndTime[0],
            end: item.startEndTime[1]
          }
        });
      });
      let data = {
        saleRoomIds: saleRoomIds,
        dateRanges: dateRanges,
        weeks: this.saleRoomCancelRuleData.weeks,
        canBeCancel: this.saleRoomCancelRuleData.canBeCancel,
        advanceCancelHours: this.saleRoomCancelRuleData.advanceCancelHours,
        advanceCancelMinutes: this.saleRoomCancelRuleData.advanceCancelMinutes,
        needPay: this.saleRoomCancelRuleData.needPay,
        cancelRemark: this.saleRoomCancelRuleData.cancelRemark
      };

      updateSalerules(data).then(res => {
        if (res.data.errCode === 0) {
          this.$message.success("修改成功");
          this.getProductQuerys();
          this.pathEditCancelRule = false;
        }
      });
    },
    /* 新增售卖房型展示按钮 */
    addSellingHouse(data) {
      this.physicsRoomName = data.roomName;
      this.physicsStaticRoomId = data.id;
      this.addSellingHouseType = true;
      getloadItens(this.defaultValue).then(res => {
        if (res.data.errCode === 0) {
          this.supplierNames = res.data.supplierNames;
          this.physicsBedTypeEntities = res.data.bedTypeEntities;
        }
      });
    },
    /* 新增售卖房型保存 */
    savePhysics() {
      this.physicsRoomData.saleRoomBaseInfo.saleHotelId = this.defaultValue.saleHotelId;
      this.physicsRoomData.saleRoomBaseInfo.roomId = this.physicsStaticRoomId;
      addSaleRoom(this.physicsRoomData, this.defaultValue).then(res => {
        if (res.data.errCode === 0) {
          this.RoomtableData = res.data.staticRoomEntities;
          this.dataSet(this.RoomtableData);
          this.$message.success("新增房型成功");
          this.resetData();
        }
        this.addSellingHouseType = false;
      });
    },
    tickerStateData() {
      this.staticRoomPopover = [];
      this.saleRoomPopover = [];
      for (let i = 0; i < this.calendarCheckAll.length; i++) {
        if (this.calendarCheckAll[i].parent) {
          this.staticRoomPopover.push(this.RoomtableData[i].id);
          if (this.RoomtableData[i].saleRoomEntities) {
            this.RoomtableData[i].saleRoomEntities.forEach(item => {
              this.saleRoomPopover.push(item.id);
            });
          }
        } else {
          if (this.calendarCheckAll[i].children.length > 0) {
            this.staticRoomPopover.push(this.RoomtableData[i].id);
            this.calendarCheckAll[i].children.forEach(item => {
              this.saleRoomPopover.push(item);
            });
          }
        }
      }
    },
    /* 批量修改房态弹窗展示按钮 */
    batchSetting(type) {
      this.type = type;
      if(type==1) {
        this.saleRoomCancelRuleData.advanceCancelHours = "";
        this.saleRoomCancelRuleData.advanceCancelMinutes = "";
      }else{
         this.saleRoomCancelRuleData.advanceCancelHours = "00";
        this.saleRoomCancelRuleData.advanceCancelMinutes = "15";
      }
      this.pathEditCancelRule = true;
      this._getMinimalList();
    },
    /* 批量修改房态保存按钮 */
    batchEditRoomState() {
      this.roomSetData();
      this.editSaleRoomPatch.saleHotelId = this.defaultValue.saleHotelId;
      this.editSaleRoomPatch.saleRoomIds = this.saleRoomPopover;
      new Promise((resolve, reject) => {
        resolve(
          this.editSaleRoomPatch.dateRanges.forEach(item => {
            delete item.parent;
          })
        );
      }).then(() => {
        updateRoomStatus(this.editSaleRoomPatch, this.defaultValue).then(
          res => {
            if (res.data.errCode === 0) {
              this.RoomtableData = res.data.staticRoomEntities;
              this.dataSet(this.RoomtableData);
              this.$message.success("房态修改成功");
              this.buttonFormVisible = false;
            }
            this.resetData();
          }
        );
      });
    },

    //批量修改房量
    patchSetRoomSum() {
      this.type = "";
      this.patchRoomSum = true;
      this._getMinimalList();
    },
    ifVipPrice(value) {
      console.log(value);
      this.isVipPrice = value;
    },
    //获取售卖房型列表数据
    _getMinimalList() {
      let { saleHotelId } = this.defaultValue;
      getMinimalList({
        saleHotelId,
        type: this.type,
        staticRoomIds: [],
        saleRoomIds: []
      }).then(res => {
        let list = res.data.list;
        list.forEach(item => {
          item.checked = false;
          item.roomCount = 1;
          item.salePrice = undefined;
        });
        this.saleRooms = list;
      });
    },
    /* 批量改价展示按钮 */
    patchPriceNumber() {
      this.type = "";
      this.patchPrice = true;
      this._getMinimalList();
    },
    patchRoomNumSave() {
      //表单验证
      let flag = false;
      for (let item of this.saleRooms) {
        if (item.checked) {
          flag = true;
        }
      }
      if (!flag) {
        this.$message.error("请至少选择一个售卖房型");
        return false;
      }
      for (let item of this.saleRoomNum.dateSpans) {
        if (!item.startEndTime.length) {
          this.$message.error("请输入变更日期");
          return false;
        }
      }
      if (!this.saleRoomNum.weeks.length) {
        this.$message.error("请输入适用星期");
        return false;
      }
      if (!this.saleRoomNum.quantity) {
        this.$message.error("请输入房量");
        return false;
      }
      // 组装数据
      let { saleHotelId } = this.defaultValue;
      let data = {
        saleHotelId,
        weeks: this.saleRoomNum.weeks,
        saleRoomIds: [],
        dateRanges: [],
        operator: this.saleRoomNum.operator,
        quantity: this.saleRoomNum.quantity
      };
      this.saleRoomNum.dateSpans.forEach(item => {
        data.dateRanges.push({
          dateSpan: {
            start: item.startEndTime[0],
            end: item.startEndTime[1]
          }
        });
      });
      this.saleRooms.forEach(item => {
        if (item.checked) {
          data.saleRoomIds.push(item.id);
        }
      });
      updateRoomStatus(data).then(res => {
        if (!res.data.errCode) {
          this.$message.success("修改成功");
          this.getProductQuerys();
          this.patchRoomSum = false;
        }
      });
    },
    //批量改价全选
    allSelect(bollean) {
      this.saleRooms.forEach(item => {
        item.checked = bollean;
      });
    },
    //批量改价单选
    onlySelect() {
      let flag = false;
      this.saleRooms.forEach(item => {
        if (!item.checked) {
          flag = true;
        }
      });
      if (flag) {
        this.checked = false;
      } else {
        this.checked = true;
      }
    },
    /**增加日期 */
    addDate(obj) {
      obj.push({
        startEndTime: []
      });
    },
    /****减少日期 */
    reduceDate(index, obj) {
      obj.splice(index, 1);
    },
    /* 批量改价保存按钮 */
    patchPriceNumberSave() {
      /**表单验证 */
      for (let item of this.saleRoomPrices.dateSpans) {
        if (!item.startEndTime.length) {
          this.$message.error("请输入变更日期");
          return false;
        }
      }
      if (!this.saleRoomPrices.weeks.length) {
        this.$message.error("请输入适用星期");
        return false;
      }
      let flag = false;
      for (let item of this.saleRooms) {
        if (item.checked) {
          flag = true;
        }
      }
      if (!flag) {
        this.$message.error("请至少选择一个售卖房型");
        return false;
      } else {
        for (let item of this.saleRooms) {
          if (item.checked && !item.salePrice) {
            if (this.saleRoomPrices.roomSet == 1) {
              this.$message.error("请填写完成的售卖房型网络价格");
              return false;
            } else {
              this.$message.error("请填写完成的售卖房型降价金额");
              return false;
            }
          }
        }
      }
      // 组装数据

      let data = {
        weeks: this.saleRoomPrices.weeks,
        roomSet: this.saleRoomPrices.roomSet,
        dateSpans: [],
        sellMoenys: []
      };
      this.saleRoomPrices.dateSpans.forEach(item => {
        data.dateSpans.push({
          start: item.startEndTime[0],
          end: item.startEndTime[1]
        });
      });
      this.saleRooms.forEach(item => {
        if (item.checked) {
          data.sellMoenys.push({
            saleRoomId: item.id,
            salePrice: item.salePrice,
            roomCount: item.roomCount
          });
        }
      });

      updateRoomPrices(data).then(res => {
        if (res.data.errCode === 0) {
          this._getProductQuery();
          this.$message.success("修改成功");
          this.patchPrice = false;
        }
      });
    },

    batchAdd() {
      this.editSaleRoomPatch.dateRanges.push({
        dateSpan: { start: "", end: "" },
        weeks: [],
        parent: false
      });
    },
    batchDelete(index) {
      this.editSaleRoomPatch.dateRanges.splice(index, 1);
    },
    handleCheckedCitiesChange() {},
    /* 列表全选按钮 */
    calendarCheckChange(val) {
      for (let i = 0; i < this.calendarCheckAll.length; i++) {
        if (val) {
          this.calendarCheckAll[i].parent = true;
          if (this.threeLayersData[i].length > 0) {
            this.threeLayersData[i].forEach(item => {
              this.calendarCheckAll[i].children.push(item.id);
            });
          }
        } else {
          this.calendarCheckAll.forEach(item => {
            item.parent = false;
            item.children = [];
          });
        }
      }
    },
    /* 售卖房型勾选按钮 */
    handleCheckedRoomNameChange(data, item, index) {
      if (
        this.calendarCheckAll[index].children.length ===
        data.saleRoomEntities.length
      ) {
        this.calendarCheckAll[index].parent = true;
        this.numArrayThrid++;
        if (this.numArrayThrid === this.calendarCheckAll.length)
          this.calendarAll = true;
      } else {
        this.numArrayThrid--;
        this.calendarAll = false;
        this.calendarCheckAll[index].parent = false;
      }
    },
    /* 物理房型勾选按钮 */
    handleCheckedRoomTableChange(data, index) {
      if (this.calendarCheckAll[index].parent) {
        this.numArray++;
        data.saleRoomEntities.forEach(item => {
          this.calendarCheckAll[index].children.push(item.id);
        });
        if (this.numArray === this.calendarCheckAll.length)
          this.calendarAll = true;
      } else {
        if (this.numArray.length > 1) {
          this.numArray--;
          this.calendarAll = false;
        } else {
          this.numArray = 0;
        }
        this.calendarCheckAll[index].children = [];
      }
    },
    staticSetSelectAll(val) {
      for (let i = 0; i < this.staticRoomsCheck.length; i++) {
        if (val) {
          this.staticRoomsCheck[i].parent = true;
          this.staticRoomPopover.push(this.staticRoomIds[i]);
          if (this.threeLayersDataSeconde[i].length > 0) {
            this.threeLayersDataSeconde[i].forEach(item => {
              this.staticRoomsCheck[i].children.push(item.id);
              this.saleRoomPopover.push(item.id);
            });
          }
        } else {
          this.staticRoomsCheck[i].parent = false;
          this.staticRoomsCheck[i].children = [];
          this.staticRoomPopover = [];
          this.saleRoomPopover = [];
        }
      }
    },
    /* 弹窗全选按钮 */
    staticRoomsCheckAllChange(val) {
      this.staticSetSelectAll(val);
    },
    roomSetData() {
      this.staticRoomPopover = [];
      this.saleRoomPopover = [];
      for (let i = 0; i < this.staticRoomsCheck.length; i++) {
        if (this.staticRoomsCheck[i].parent) {
          this.staticRoomPopover.push(this.staticRooms[i].id);
          if (this.staticRooms[i].saleRooms) {
            this.staticRooms[i].saleRooms.forEach(item => {
              this.saleRoomPopover.push(item.id);
            });
          }
        } else {
          if (this.staticRoomsCheck[i].children.length > 0) {
            this.staticRoomPopover.push(this.staticRooms[i].id);
            this.staticRoomsCheck[i].children.forEach(item => {
              this.saleRoomPopover.push(item);
            });
          }
        }
      }
    },
    /* 弹窗物理房型按钮 */
    staticRoomsCheckChange(data, index) {
      if (this.staticRoomsCheck[index].parent) {
        this.numArraySeconde++;
        data.saleRooms.forEach(item => {
          this.staticRoomsCheck[index].children.push(item.id);
          this.saleRoomPopover.push(item.id);
        });
        if (this.numArraySeconde === this.staticRoomsCheck.length)
          this.settingRoomcheckAll = true;
        this.staticRoomPopover.push(data.id);
      } else {
        if (this.numArraySeconde > 1) {
          this.numArraySeconde--;
          this.settingRoomcheckAll = false;
        } else {
          this.numArraySeconde = 0;
        }
        this.staticRoomsCheck[index].children = [];
      }
    },
    handleCheckAllChange(val) {
      this.saleRooms.forEach(item => {
        item.checked = val;
      });
    },
    handleCheckedRoomDataChange(value) {
      let flag = true;
      this.saleRooms.forEach(item => {
        if (!item.checked) {
          flag = false;
        }
      });
      this.checked = flag;
    },
    getProductQuerys() {
      getProductQuery(this.defaultValue).then(res => {
        if (res.data.errCode === 0) {
          this.RoomtableData = res.data.staticRoomEntities;
          this.resetData();
        }
      });
    },
    handleRoomSizeChange(val) {
      this.RoomPageSize = val;
      this.defaultValue.pageSize = val;
      this.getProductQuerys();
    },
    handleRoomCurrentChange(val) {
      this.RoomCurrentPage = val;
      this.defaultValue.pageNum = val;
      this.getProductQuerys();
    }
  }
};
</script>

<style lang="scss">
.time-select-1 {
  .el-input {
    width: 80px;
  }
}

#property-management {
  margin-top: 6px;
  .room-check-warpper {
    overflow: hidden;
  }
  .calendar-list {
    .calendar-header {
      padding: 11px 0;
      background-color: rgb(238, 241, 248);
      .calendar-header-warpper {
        overflow: hidden;
        .item {
          margin-left: 20px;
          width: 8.16%;
          float: left;
          label {
            font-size: 12px;
          }
        }
      }
    }
    .calendar-body {
      width: 100%;
      .calendar-body-warpper {
        width: inherit;
        .calendar-warpper-content {
          width: inherit;
          .calendar-content {
            overflow: hidden;
            width: inherit;
            border-bottom: 1px solid #f6f6f6;
            .calendar-content-module {
              overflow: hidden;
              .el-checkbox__label {
                font-size: 12px;
              }
              .physics,
              .date-information,
              .operation {
                float: left;
              }
              .physics {
                margin-left: 1.3%;
                width: 8.27%;
                padding-top: 10px;
                label,
                button {
                  font-size: 12px;
                }
                button {
                  padding: 0;
                }
              }
              .date-information {
                width: 90%;
                min-height: 80px;
                .date-warpper {
                  overflow: hidden;
                  .up-style {
                    background-color: #f6f6f6;
                  }
                  .down-style {
                    color: #abb7c3;
                  }
                  .sale-room-title,
                  .sale-date {
                    float: left;
                  }
                  .sale-room-title {
                    text-align: center;
                    width: 100%;
                    font-size: 12px;
                    button {
                      font-size: 12px;
                      padding: 0;
                    }
                    .sale-room-title-item {
                      width: 100%;
                      overflow: hidden;
                      text-align: left;
                      padding-left: 20px;
                      position: relative;
                      line-height: 2;
                      &:before {
                        content: "";
                        position: absolute;
                        left: 20px;
                        bottom: 0px;
                        right: 20px;
                        border-top: 1px solid #f2f2f2;
                      }
                      &:last-child:before {
                        border-top: 0;
                      }
                      .sale-title-content {
                        margin-top: 10px;
                        width: 8.1%;
                        float: left;
                        .el-checkbox-group {
                          text-align: left;
                          margin-left: 13.3%;
                        }
                        label {
                          .el-checkbox__label {
                            max-width: 100%;
                            white-space: normal;
                            text-overflow: ellipsis;
                            overflow: hidden;
                            text-align: center;
                            line-height: 1;
                          }
                        }
                        button {
                          margin-right: 26.3%;
                        }
                      }
                      .sale-date {
                        width: 75%;
                        padding: 10px 0;

                        .item {
                          float: left;
                          width: 14.1%;
                          text-align: left;
                          font-size: 12px;
                          min-height: 120px;
                          label {
                            font-size: 12px;
                          }
                          .item-content {
                            padding: 0 5px;
                            .item-child {
                              .item-text {
                                text-align: left;
                                padding-left: 20px;
                              }
                            }
                          }
                          .red {
                            color: red;
                          }
                        }
                      }
                      .operation {
                        text-align: left;
                        width: 14.38%;
                        padding-top: 5px;
                        line-height: 87px;
                        button {
                          font-size: 12px;
                          padding: 0;
                          margin-left: 7%;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          .calendar-content:hover {
            background-color: #f8f9fd;
          }
        }
      }
    }
    .calendar-foot {
    }
    .warpper-first,
    .warpper-second,
    .warpper-third {
      margin: 0;
      position: relative;
      border-radius: 3px;
      .closed,
      .manchu {
        position: absolute;
        top: 0;
        right: 0;
        font-size: 12px;
        width: 16px;
        height: 16px;
        line-height: 16px;
        color: #fff;
      }
      .closed {
        background-color: #ff9913;
      }
      .manchu {
        background-color: #f2665d;
      }
    }
    .warpper-first,
    .warpper-second,
    .warpper-third {
      border: 1px solid transparent;
    }
    .warpper-first:hover {
      border: 1px solid #f2665d;
    }
    .warpper-second:hover {
      border: 1px solid #ff9913;
    }
    .warpper-third:hover {
      border: 1px solid #6d2377;
    }
  }
  .dialog-footer {
    text-align: center;
  }
  .el-dialog__header {
    text-align: left;
    background-color: rgb(243, 245, 249);
  }
  .el-select {
    .el-input {
      input {
        height: 30px;
        line-height: 30px;
      }
    }
  }
  .warpper {
    margin-bottom: 20px;
    .titleBtn {
      float: left;
      .el-dialog__header {
        .el-dialog__headerbtn {
          border: none;
        }
      }
      .btn {
        button {
          padding: 8px 15px;
          color: #6d2377;
          border: 1px solid #6d2377;
          font-size: 12px;
          margin-left: 0;
        }
        .add-room-warpper,
        .patch-price,
        .patch-setting,
        .patch-posted,
        .patch-edit,
        .if-price {
          float: left;
          margin-right: 5px;
        }
        .patch-posted {
          .posted-select {
            .el-form-item__content {
              line-height: 2.8;
            }
          }
          .el-dialog__footer {
            .el-button--primary {
              color: #fff;
            }
          }
        }
        .patch-setting {
          .el-dialog__wrapper {
            .el-dialog {
              .el-dialog__footer {
                .dialog-footer {
                  .el-button--primary {
                    color: #fff;
                  }
                }
              }
            }
          }
          .rule {
            padding-left: 4%;
            .radio-page-style {
              float: left;
              margin-right: 10px;
            }
            .radio-warpper {
              display: inline-block;
            }
            .el-radio__label {
              font-size: 12px;
            }
            div {
              font-size: 12px;
            }
            .el-select {
              width: 95px;
              .el-input {
                width: inherit;
              }
            }
            .el-form-item {
              margin-bottom: 10px;
              .el-form-item__content {
                .el-form-item {
                  overflow: hidden;
                }
              }
            }
            .el-form-item__label {
              width: 110px;
            }
            .left,
            .right {
              float: left;
            }
            .right {
              .el-radio__label {
                font-size: 12px;
              }
            }
            .radio-left,
            .radio-right {
              float: left;
            }
          }
          .el-input {
            width: 80px;
          }
          .el-col-5 {
            width: 5%;
            text-align: center;
            font-size: 12px;
            line-height: 2.8;
          }
          .el-col-4 {
            width: 2%;
            text-align: center;
            font-size: 12px;
            line-height: 2.8;
          }
          .el-col-2 {
            width: 1%;
            text-align: center;
            font-size: 12px;
            line-height: 2.8;
          }
          .el-col-7 {
            width: 10%;
            text-align: center;
            font-size: 12px;
            line-height: 2.8;
          }
          .el-col-3 {
            width: 7%;
            text-align: center;
            font-size: 12px;
            line-height: 2.8;
          }
          .el-select {
            margin: 0 5px;
          }
        }
        .add-room-warpper {
          .add-check {
            width: 25%;
            float: left;
          }
        }
        .patch-price {
          .el-checkbox__label {
            font-size: 12px;
          }
          .el-checkbox + .el-checkbox {
            margin-left: 20px;
          }
          .el-dialog__body {
            padding: 10px 30px 30px 30px;
          }
          .el-checkbox-group {
            line-height: 3.2;
            .el-checkbox {
              .el-checkbox__label {
                font-size: 12px;
              }
            }
          }
          .price-picker {
            position: relative;
            display: inline-block;
            margin-top: 6px;
            .el-col-10 {
              width: 33.66667%;
              .line {
                width: 6%;
              }
            }
            .add {
              position: absolute;
              right: 18%;
              top: 18%;
              color: #6d2377;
            }
            .delete {
              position: absolute;
              right: 10%;
              top: 18%;
              color: #6d2377;
            }
          }
          .el-table__body td .cell {
            text-align: left;
          }
          .el-date-editor {
            line-height: 2.8;
          }
          .line {
            text-align: center;
            line-height: 2.8;
          }
          .price-table {
            .el-table {
              .el-table__header-wrapper table thead tr th {
                text-align: left;
              }
            }
          }
        }
      }
    }
    .calendar {
      float: right;
      overflow: hidden;
      .el-input__icon {
        line-height: 0;
      }
      .select,
      .left-btn,
      .right-btn,
      .date {
        float: left;
        button {
          font-size: 12px;
          width: 70px;
        }
      }

      .date {
        .el-date-editor {
          .el-input__prefix {
            .el-input__icon {
              line-height: 32px;
            }
          }
        }
      }
      .select {
        width: 70px;
        margin-right: 20px;
        .el-select {
          width: inherit;
          .el-input--suffix {
            width: inherit;
            input {
              width: inherit;
            }
          }
        }
      }
      .el-button {
        padding: 8px 15px;
      }
      .left-btn {
        margin-right: 20px;
      }
      .right-btn {
        margin-left: 20px;
      }
    }
  }
  .icon_ {
    font-size: 18px;
    color: #fff;
    border: 1px solid #ddd;
    padding: 2px;
    background: #6d2377;
    font-weight: bold;
    &:hover {
      cursor: pointer;
    }
  }
  .prices-list {
    & > li {
      padding-left: 10px;
      & > span {
        display: inline-block;
        &.list-header {
          width: 300px;
          text-align: center;
        }
        & > span {
          display: inline-block;
          width: 150px;
        }
      }
    }
  }
}
.edit-rules .el-form-item {
  margin-bottom: 5px;
}
</style>
